const mongoose = require('mongoose');

const chalk = require('chalk');

const success = chalk.bold.green;

const error = chalk.bold.red;

const URL = "mongodb://47.117.117.139:27017/dataDb";

var db = mongoose.createConnection(URL,{ useNewUrlParser: true }, function(err, db) {
	if(err){
		console.log(error('数据库连接失败:' + err));
	}else{
		console.log(success('数据库连接成功'));
	}
});

/**
 * private
 * 封装连接数据库
*/

module.exports = db;
